import { CHANNEL_SET_ACTIVE, CHANNEL_SET_LIST } from '../action/channel'

const initState = {
  list: [],
  active: 0,
}

// 频道 reducer
export default function channelReducer(state = initState, action) {
  switch (action.type) {
    // 设置频道列表
    case CHANNEL_SET_LIST:
      return { ...state, list: action.payload }
    case CHANNEL_SET_ACTIVE:
      return { ...state, active: action.payload }
    default:
      return state
  }
}
